<?php
class Hd
{
	public static function run()
	{
		if(!is_dir("App")){
			//创建目录,复制文件
			self::createDir();
			self::copyFile();
			
		}
		//载入核心文件
		self::loadCore();
		//执行应用类
		Hdphp\Libs\App::run();
		
	}
	//创建目录
	private static function createDir()
	{
		$dirs = array(
			//创建App/Home/Config
			"App/Home/Config",
			//创建App/Home/IndexController
			"App/Home/Controller",
			//创建App/Home/View/Index
			"App/Home/View/Index",
			//放js,css
			"Public",
		
		);
		foreach($dirs as $v){
			is_dir($v) || mkdir($v,0777,true);
		}
		
	}
	//复制文件
	private static function copyFile()
	{
		copy("Hdphp/Common/userConfig.php", "App/Home/Config/config.php");
		copy("Hdphp/Common/IndexController.php", "App/Home/Controller/IndexController.php");
		copy("Hdphp/Common/index.php", "App/Home/View/Index/index.php");
	}
	
	//载入核心文件
	private static function loadCore()
	{
		//载入函数库
		require "Hdphp/Libs/functions.php";
		//载入smarty
		require "Hdphp/Org/smarty/Smarty.class.php";
		//载入SmartyView
		require "Hdphp/Libs/SmartyView.php";
		//载入控制器
		require  "Hdphp/Libs/Controller.php";
		//载入应用类
		require "Hdphp/Libs/App.php";
	}
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
}
Hd::run();
